class ProductionController < ApplicationController
  
  def search
    @query = params[:q] || ""
    @items = Item.search_blueprint(@query)
    if @items.empty?
      flash[:notice] = "Sorry nothing found!"
      redirect_to :action => "index"
    else
      @items.each_with_index do |item, i|


        @items[i].total_isk = item.calculate_minerals(0, 4).total
      end
      render_partial_collection "item", @items
    end
  end
  
  
  def show
    redirect_to :action => "index" unless params[:id]
  #  @user = @user.reload
    @item = Item.find(params[:id]) 
    @mins = @item.calculate_minerals(params[:me] ? params[:me].to_s : 0, 4)#@user.skill_me)
    @me = @item.calculate_me(100, 4)#@user.skill_me)
#    logger.debug @me.values[0].keys
  end
  
  
  
end
